<template>
  <div class="child">
    <h2>{{ car }}</h2>
    <h2>{{ age }}</h2>
    <h2>{{ name }}</h2>
    <!-- 携带方法给父亲传送过去 -->
    <button @click="sendToy(toy)">传参</button>
  </div>
</template>

<script>
export default {
  name: "Child",
  data() {
    return {
      toy: "奥佩特曼",
    };
  },
  props: ["car", "age", "name", "sendToy"],
};
</script>

<style scoped>
.child {
  margin-top: 10px;
  padding: 20px;
  background-image: linear-gradient(0deg, #cfd9df 0%, #e2ebf0 100%);
  border-radius: 20px;
}
</style>